﻿var score = {
  set:function(id,tscore){
    $.cookie("classitem"+id,tscore, { expires: 365, path: '/' });
    
    var idN = Number(id);
    var scoreN = Number(tscore);
    var nextid = (idN+1).toString();
    if(scoreN>94 && score.get(nextid)==null ){
      score.set( nextid,'');
    }
  },
  get:function(id){
    return $.cookie("classitem"+id);
  },
  init:function(){  
    $(".classitem").each(function(){
        $classscore = $(this).find(".classscore");
        var itemid =$classscore.attr('itemid'); 
        var s = score.get(itemid);
        if( itemid=='0' && s==null){
          s='';
        }
        if( s!=null ){
          $classscore.html( s );
        }else{
          $classscore.html( '<img src="'+cacheUrl+'image/lock.png"></img>' );
          $classname = $(this).find(".classname");
          $classname.click(function(){
            alert('锁定中。前一组到达95分以上，本组自动解锁。');
            return false;
          });
        }        
      })      
  }
}